<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
<script type="text/javascript">
console.log(JSON.stringify('\u{D800}'))//ES10之前会报错

let arr = [1,[2,3],[4,5,[6,7,[8,9,10]]]]
console.log(arr.flat()) //(6) [1, 2, 3, 4, 5, Array(3)],没传参数的时候：默认值是1
console.log(arr.flat(10))//(10) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

let arr1 = [1,2,3]
console.log(arr1.flatMap(item=>[item*2])) //(3) [2, 4, 6]

let str = '  foo  '
console.log(str.trimStart()) //foo  trimStart和trimLeft一样
console.log(str.trimEnd())//  foo,trimEnd和trimRight一样
console.log(str.trim())//foo,去除首尾空格


</script>
</body>

</html>